home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5783 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  40 lines

  1. Path: wabbit.cc.uow.edu.au!not-for-mail
  2. From: tp86@wumpus.cc.uow.edu.au (PAOPENG THEERADECH)
  3. Newsgroups: comp.lang.c++
  4. Subject: float....question
  5. Date: 7 Feb 1996 01:24:49 +1100
  6. Organization: University of Wollongong, NSW, Australia.
  7. Message-ID: <4f7obh$lej@wumpus.cc.uow.edu.au>
  8. NNTP-Posting-Host: wumpus.cc.uow.edu.au
  9. X-Newsreader: NN version 6.5.0 #5
  10.  
  11. Hello to all.
  12.     I got the problem about "float" to ask you guys. I just try to write 
  13. the simple program to handle the float. The program as below
  14.  
  15. #include <iostream.h>
  16.  
  17. main()
  18. {
  19. float Number;
  20.  
  21. cout << "Please type the number in decimal point" << endl;
  22. cin >> Number;
  23. cout << "The number that you type in is: " << Number << endl;
  24. }
  25.  
  26. When I type 5.5 in, I got the output as 5.49999999
  27. The number that i got from that program very close to the number that I just
  28. type in. Anyway, that not the number that I expect to got.
  29.  
  30. Could anyone here please kind to tell me what wrong with this?????
  31.  
  32. Please reply by e-mail if it possible.... :)
  33.  
  34. Thanks in advance
  35.  
  36. --
  37. T.Paopeng
  38. e-mail: tp86@wumpus.cc.uow.edu.au
  39.  
  40.